/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-10-28
 * Time: 22:07
 */
abstract class Animal{   //动物类
    private String name;//名字
    private String color;//颜色
    private String type;//类别（哺乳类、非哺乳类）
    public Animal(String name, String color, String type){
        this.name = name;
        this.color = color;
        this.type = type;
    }
    public String getName(){
        return name;
    }
    public String getColor(){
        return color;
    }
    public String getType(){
        return type;
    }
    public abstract void shout();
    public abstract void eat();
}
interface Swimmable{
    abstract void swim();
}
interface Flyable{
    abstract void fly();
}
class Rabbit extends Animal{

    public Rabbit(String name, String color, String type) {
        super(name, color, type);
    }

    @Override
    public void shout() {
        System.out.println("那只"+getColor()+"的，名字叫"+getName()+"的兔子正在叽叽的叫");
    }

    @Override
    public void eat() {
        System.out.println("兔子是"+getType()+",爱吃胡萝卜");
    }
}
class Frog extends Animal implements Swimmable{

    public Frog(String name, String color, String type) {
        super(name, color, type);
    }

    @Override
    public void shout() {
        System.out.println("那只"+getColor()+"的，名字叫"+getName()+"的青蛙正在呱呱的叫");
    }

    @Override
    public void eat() {
        System.out.println("青蛙是"+getType()+",爱吃昆虫");
    }

    @Override
    public void swim() {
        System.out.println("青蛙是游泳高手");
    }
}
class Eagle extends Animal implements Flyable{

    public Eagle(String name, String color, String type) {
        super(name, color, type);
    }

    @Override
    public void shout() {
        System.out.println("那只"+getColor()+"的，名字叫"+getName()+"的老鹰正在啾啾的叫");
    }

    @Override
    public void eat() {
        System.out.println("老鹰是"+getType()+",爱吃小鸡");
    }

    @Override
    public void fly() {
        System.out.println("老鹰是飞翔高手");
    }
}
/* 请在这里填写答案 */

public class Main{
    public static void main(String[] args) {
        AnimalAction(new Rabbit("小白", "白色", "哺乳类"));
        System.out.println("====================");
        AnimalAction(new Frog("弗洛格", "绿色", "非哺乳类"));
        SwimAction(new Frog("弗洛格", "绿色", "非哺乳类"));
        System.out.println("====================");
        AnimalAction(new Eagle("凤头鹰","灰色","非哺乳类"));
        FlyAction(new Eagle("凤头鹰","灰色","非哺乳类"));
    }
    public static void AnimalAction(Animal an) {
        an.shout();
        an.eat();
    }
    public static void SwimAction(Swimmable s) {
        s.swim();
    }
    public static void FlyAction(Flyable f) {
        f.fly();
    }
}